package com.itheima.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealCheckGroupMapper {

    /**
     * 给套餐添加检查组
     * @param setmealId
     * @param checkGroupId
     */
    @Insert("insert into t_setmeal_checkgroup values(#{setmealId},#{checkGroupId})")
    void addCheckGroupToSetmeal(Integer setmealId, Integer checkGroupId);

    /**
     * 根据套餐id查询检查组
     * @param setmealId
     * @return
     */
    @Select("select checkgroup_id from t_setmeal_checkgroup where setmeal_id = #{setmealId}")
    List<Integer> findCheckGroupIdsBySetmealId(Integer setmealId);

    /**
     * 根据套餐id删除检查组
     * @param id
     */
    @Delete("delete from t_setmeal_checkgroup where setmeal_id = #{id}")
    void deleteGroupFromSetmeal(Integer id);
}
